function SiteEntryTest(name) 
{	
	this.base = TestCase;
	this.base(name);
	this.className = "SiteEntryTest";
}
SiteEntryTest.prototype = new TestCase;

SiteEntryTest.testing = function () { return [ "file:///home/dafyddj/src/takecontrol/trunk/components/TakeControlService.js" ]; }

var database, date1, date2, session1, session2,
	siteEntry;
	
const siteId = "www.google.com";

SiteEntryTest.prototype.setUp = function()
{
	database = new Database();
	date1 = new Date(2006, 2, 28).getW3CDate();
	date2 = new Date(2006, 3, 1).getW3CDate();

	session1 = database._createSessionEntry(date1, 50);
	siteEntry = database._createSiteEntry(siteId);
}

SiteEntryTest.prototype.testSessionExists = function SET_testSessionExists() {
	assertNull(siteEntry.sessionExists(date1));
	siteEntry.add(session1);
	assertNotNull(siteEntry.sessionExists(date1));
}

SiteEntryTest.prototype.testSessionNonExistant = function SET_testSessionNonExistant() { 
	siteEntry.add(session1);
	assertNull(siteEntry.sessionExists(date2));
}

SiteEntryTest.prototype.testGetSiteId = function SET_testGetSiteId() {
	assertEquals(siteId, siteEntry.getSiteId());	
}

SiteEntryTest.prototype.testGetSessionDuration = function SET_testGetSessionDuration() {
	siteEntry.add(session1);
	assertEquals(50, siteEntry.getSessionDuration(date1));
}

SiteEntryTest.prototype.testUpdateSessionEntry = function SET_testUpdateSessionEntry() {
	siteEntry.add(session1);
	siteEntry.updateSessionDuration(date1, 100);
	assertEquals(100, siteEntry.getSessionDuration(date1));
}
